package klimuts.periodicals.user;

import klimuts.periodicals.catalog.Catalog;
import klimuts.periodicals.catalog.Periodical;

/**
 * Users cart. Placed in current session only and not have any 
 * link to owner.
 * @author Siarhei Klimuts
 * */
public class Cart extends Catalog{
	
	public Cart() {
		super();
	}
	
	public String toString() {
		return size()+": "+getPrice();
	}

	/**
	 * Calculate result price of all items in cart
	 * @return Return <code>float</code> result of total price
	 */
	public float getPrice(){
		float result=0;
		for (Periodical periodical: this) {
			result+=periodical.getPrice();
		}
		return result;
	}
	
}
